package com.gilight.base.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gilight.base.dto.CouponAdminDTO;
import com.gilight.base.dto.CouponDTO;
import com.gilight.base.model.CouponDO;
import com.gilight.base.model.KVModel;
import com.gilight.base.model.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * Created by rize on 2019/7/4.
 */
@Repository
public interface CouponMapper extends IMapper<CouponDO> {

    public Integer decCoupon(Long couponId);

    //这样写MyBatis无法直接映射泛型，只能用Long了
    public List<KVModel<Long,Long>> getUserCouponsCount(@Param("userId") Long userId, @Param("couponIds") List<Long> couponIds);

    public List<CouponDTO> getActiveCoupons();

    public List<CouponDTO> getActiveCouponsByPlatformAndBrand(@Param("brandId") Long brandId, @Param("typeStr") String typeStr,@Param("zzjgid") Long zzjgId);

    public List<CouponDTO> getActiveCouponsByShop(@Param("brandId") Long brandId,@Param("zzjgId") Long zzjgId);
    public List<CouponDTO> getActiveCouponsByUserShop(@Param("brandId") Long brandId,@Param("zzjgId") Long zzjgId,@Param("userId") Long userId);

    public Page<CouponAdminDTO> getAdminCouponList(IPage<CouponAdminDTO> page, @Param("title") String title, @Param("type") Integer type, @Param("status") Integer status, @Param("now") Date now,@Param("zzjgid") Long zzjgid);

}
